/*
 *  (C) Copyright 2007 Insula Tecnologia da Informacao Ltda.
 * 
 *  This file is part of Jazz.
 *
 *  Jazz is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU Lesser General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  Jazz is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public License
 *  along with Jazz.  If not, see <http://www.gnu.org/licenses/>.
 */
package org.openinsula.jazz.resolver.swing;

import javax.swing.JLabel;

import org.openinsula.jazz.resolver.Resolver;

/**
 * {@link Resolver} implementation that resolves {@link JLabel} properties.
 * 
 * @author yanaga
 * @since 1.0
 */
public class DefaultJLabelResolver implements Resolver {

	@Override
	public Object getValue(Object bean) {
		return ((JLabel) bean).getText();
	}

	@Override
	public void setValue(Object bean, Object value) {
		if (value == null) {
			((JLabel) bean).setText("");
		}
		else {
			((JLabel) bean).setText(value.toString());
		}
	}

}
